﻿using LitJson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class Character
{
    public enum CharacterKind
    {
        CHARACTER_NONE,         //无
        CHARACTER_BOLD,         //胆大, 前移速
        CHARACTER_TIMID,        //胆小，后移速
        CHARACTER_BRAVE,        //勇敢，结构
        CHARACTER_SD,           //沙雕，技能冷却
        CHARACTER_NIUBI,        //牛逼，伤害
        CHARACTER_OBSCENE,      //猥琐，射程
        CHARACTER_CRAZY,        //疯狂，射速
        CHARACTER_CALM,         //冷静，全
        CHARACTER_CHANGED,      //善变，武器角度
        CHARACTER_IRONMAN,      //硬汉，碰撞伤害
        //CHARACTER_GREED,        //贪婪，战利品

    }
    public CharacterKind m_Kind = CharacterKind.CHARACTER_NONE;
    public string m_Name = "性格";
    public string m_Describe ="你的性格";

    public virtual CharacterKind InitShip(Ship ship)
    {
        return m_Kind;
    }

    public JsonData Save()
    {
        JsonData root = new JsonData();
        root.SetJsonType(JsonType.Object);
        root["Kind"] = m_Kind.ToString();
        return root;
    }
    public void Load(JsonData json)
    {

    }

    static public Character LoadS(JsonData json)
    {
        var kind = json["Kind"].ValueAsString();

        var character = CharacterFactory.Instance.CreateCharacter(kind);
        if (character == null)
            return character;

        character.Load(json);
        return character;
    }

    static public JsonData ReturnNullJson()
    {
        JsonData root = new JsonData();
        root.SetJsonType(JsonType.Object);
        return root;
    }
}